package com.magnificent.panda.correlation;

/**
 * User: Babanin
 * Date: 31.01.11
 * Time: 4:12
 */
public class CorrelationHelper {
    public static double countModule(double[] values) {
        double module = 0.0;

        for (int i = 1; i < values.length; i++) {
            double diff = values[i - 1] - values[i];

            if(diff < 0){
                diff *= 2;
            } else {
                diff /= 2;
            }

            module += diff;
        }

        return module;
    }
}
